#### Squashing a Branch -- Assuming "master" in this example
git rebase -i --root
### Use nano to change all but the first commit form pick to squash
### Save the commit as amended by
$ Git commit --amend -m "comment"
### Update the repository
git push origin master --force

### Setting Upstream branches
```bash
git branch --set-upstream-to <remote-branch>
# example
git branch --set-upstream-to origin feature-branch

# show up which remote branch a local branch is tracking
git branch -vv
```
sets the default remote branch for the current local branch.

Any future `git pull` command (with the current local branch checked-out), will attempt to bring in commits from the `<remote-branch>` into the current local branch.

One way to avoid having to explicitly do `--set-upstream` is to use the shorthand flag `-u` along with the very first `git push` as follows
```bash
git push -u origin local-branch
```
### Remove the tracking.
git branch --unset-upstream

###To sync up master do the follow9ing
git fetch origin master
git reset --hard FETCH_HEAD